/*
 * @Author: 高富强
 * @Email: 875627570@qq.com
 * @Date: 2020-06-03 09:56:23
 * @Last Modified by: 高富强
 * @Last Modified time: 2020-06-03 09:56:23
 * @Description: 网络请教对象类，相当于BAL
 * ///请求示例
  // Future<Response> register({ @required String code, String city,}) {
  //   return _dio.post(
  //     '/user/email/register',
  //     queryParameters: {
  //       "code": code,
  //       "city": city,
  //     }
  //   );
  // }

  //调用示例 
  //import 'package:flutter_code_framework/utils/global.dart';
  //var rs = await G.req.user.register(code:'',city:'');
 */


import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_code_framework/model_data/class/class.dart';

/// 用户管理相关
class ReqClass {
  final Dio _dio;

  ReqClass(this._dio);
  Future<Response> getMyClassList() {
    return _dio.get('/Class/getMyClassList'
    );
  }
  Future<Response> getPopClassList() {
    return _dio.get('/Class/getPopClassList'
    );
  }
  Future<Response> getClassInfo({String classId}) {
    return _dio.get('/Class/GetClassInfo',
        queryParameters: {
          "classId": classId,
        }
    );
  }
  //退出
  Future<Response> exit({@required String classId, @required String operation}) {
    return _dio.post('/Class/doOperation', queryParameters: {
      "classId": classId,
      "operation": operation,
    });
  }
  //解散
  Future<Response> dissolve({@required String classId, @required String operation}) {
    return _dio.post('/Class/doOperation', queryParameters: {
      "classId": classId,
      "operation": operation,
    });
  }
  //重置密码
  Future<Response> reset({@required String classId, @required String operation, @required String studentId}) {
    return _dio.post('/Class/doOperation', queryParameters: {
      "classId": classId,
      "operation": operation,
      "studentId": studentId,
    });
  }
  //移除
  Future<Response> delete({@required String classId, @required String operation, @required String studentId}) {
    return _dio.post('/Class/doOperation', queryParameters: {
      "classId": classId,
      "operation": operation,
      "studentId": studentId,
    });
  }
  //批准
  Future<Response> examine({@required String classId, @required String operation, @required String studentId}) {
    return _dio.post('/Class/doOperation', queryParameters: {
      "classId": classId,
      "operation": operation,
      "studentId": studentId,
    });
  }
  //教师申请加入
  Future<Response> apply({@required String classId}) {
    return _dio.post('/Class/apply', queryParameters: {
      "classId": classId,
    });
  }
}